package com.dfbz.demo;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_ObjectOutputStream {
    public static void main(String[] args)throws Exception {
        Goods goods = new Goods("神舟战神笔记本", 6899.0D, 2);
        System.out.println(goods);

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("oos"));

        // 将对象写入到文件中(序列化)
        oos.writeObject(goods);

        oos.close();
    }
}
